﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKGeometryFuncs;
using YJKCopyModel.InteractiveOperation;

namespace YJKCopyModel.YJKRevitWndr
{
	public class CompareSameLineTextPos : IComparer<TextInfo>
	{
		public CompareSameLineTextPos(XYZ vcDir)
		{
			this.m_vcDir = vcDir;
		}

		public int Compare(TextInfo x, TextInfo y)
		{
			bool flag = x == y;
			int result;
			if (flag)
			{
				result = 0;
			}
			else
			{
				XYZ orgPos = x.OrgPos;
				XYZ orgPos2 = y.OrgPos;
				XYZ xyz = orgPos2 - orgPos;
				bool flag2 = Geometry.IsEqual(xyz.GetLength(), 0.0);
				if (flag2)
				{
					result = 0;
				}
				else
				{
					bool flag3 = xyz.AngleTo(this.m_vcDir) <= Math.PI*.5;
					if (flag3)
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
			}
			return result;
		}

		private XYZ m_vcDir = null;
	}
}
